package semSimilarity.sentence;

import java.util.List;

import semSimilarity.P;
import semSimilarity.SimilarityGenerator;
import semSimilarity.SimilarityMatrix;
import sentStruct.Verb;

public class VerbSimGenerator implements SimilarityGenerator<Verb>{

	@Override
	public double similarity(Verb el1, Verb el2) {
		if (el1==null || el2==null )
			return 0;
		PartOfSpeechSimGenerator simGen = new PartOfSpeechSimGenerator();
		if (el1.hasAdverbs()||el2.hasAdverbs())
		return P.verbSim.verbCoeff*simGen.similarity(el1, el2)+
				P.verbSim.advCoeff*simGen.similarity(el1.getAdverbs(), el2.getAdverbs());		
		else 
			return simGen.similarity(el1, el2);
	}

	@Override
	public double similarity(List<? extends Verb> list1,
			List<? extends Verb> list2) {
		if (list1==null||list2==null)
			return 0;
		SimilarityMatrix<Verb> matrix = new SimilarityMatrix<Verb>(list1, list2, this);
		return matrix.maxSimilarityAverage();
	}

}
